Add dependency-tracking variable data type.#63
Conversation
Can you explain why the value is 120? I understand the indices. |
shakedregev
left a comment
There was a problem hiding this comment.
No major comments and tests pass, so I'm approving. I will branch off this to make some quick fixes.
nkoukpaizan
left a comment
There was a problem hiding this comment.
The PR works as advertised. It will be helpful to expand the documentation of the functionality, so people won't have to read the paper to understand what's going on.
I am also getting many warnings I did not use to see, but I don't think these are related to this PR, but to an earlier one. e.g.,
In file included from /lustre/orion/scratch/nkouk/stf006/Codes/GridKit/tests/UnitTests/PhasorDynamics/runBranchTests.cpp:1:
In file included from /lustre/orion/scratch/nkouk/stf006/Codes/GridKit/tests/UnitTests/PhasorDynamics/BranchTests.hpp:6:
In file included from /lustre/orion/scratch/nkouk/stf006/Codes/GridKit/src/Model/PhasorDynamics/Branch/Branch.hpp:11:
/lustre/orion/scratch/nkouk/stf006/Codes/GridKit/src/Model/PhasorDynamics/Component.hpp:51:22: warning: 'nnz' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
virtual IdxT nnz()
In file included from /lustre/orion/scratch/nkouk/stf006/Codes/GridKit/tests/UnitTests/PhasorDynamics/runBranchTests.cpp:1:
In file included from /lustre/orion/scratch/nkouk/stf006/Codes/GridKit/tests/UnitTests/PhasorDynamics/BranchTests.hpp:6:
In file included from /lustre/orion/scratch/nkouk/stf006/Codes/GridKit/src/Model/PhasorDynamics/Branch/Branch.hpp:11:
/lustre/orion/scratch/nkouk/stf006/Codes/GridKit/src/Model/PhasorDynamics/Component.hpp:56:22: warning: 'hasJacobian' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
virtual bool hasJacobian()
Updated PR description to clarify this. |
* Add dependency-tracking variable data type. * Fix compiler warnings. * Test chain rule with local variable. --------- Co-authored-by: shakedregev <35384901+shakedregev@users.noreply.github.com>
Add a definition for a variable type that tracks its dependencies. This dependency tracking is helpful when computing e.g. Jacobian sparsity pattern.
For example, consider function template
Substituting template parameter
GridKit::Sparse::Variable<double>would produce a function that computes vectorfsuch that each element offcontains numerical value and the list of elements ofxthat are used to compute that value. For example, with values ofxset asf[0]would contain double floating point value120.0and indices0and1. See here for more details.This PR only provides dependency tracking data type and a simple unit test.
CC @sklus